#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    db = new QSqlDatabase;
    db->addDatabase("QMYSQL");
    db->setDatabaseName("springcloud_template");
    db->setPort(3306);
    db->setHostName("localhost");
    db->setUserName("root");
    db->setPassword("123456");
    if(db->open()){
        qDebug()<<"mysql connect ok";
    }else {

        qDebug()<<"mysql connect failed";
    }

}

MainWindow::~MainWindow()
{
    delete ui;
}

